<?php
/**
 * 定阅文章分类
 * @author wangtao
 * @version 2010.12.07
 */

/**
 * 添加博客到指定类型
 * @param int $BID			博客ID
 * @param int $categoryID	分类ID
 */
function add($BID, $categoryID)
{
	$sql = 'INSERT INTO `feed`.`blogships` (`BID` ,`categoryID`) VALUES (\'' . $BID . '\', \'' . $categoryID . '\');';
	$db = mysqlDB::con();
	$db->query($sql);
}

/**
 * 查看分类ID下指定博客名
 * @param int $categoryID	分类ID
 */
function read($categoryID)
{
	$sql = 'SELECT `BID` FROM `blogships` WHERE `categoryID` =' . $categoryID;
	$db = mysqlDB::con();
	$BIDarr = $db->getOneArr($sql);
	print_r($BIDarr);
}

function slug($categorySlug)
{
	$sql = 'SELECT `BID` FROM `blogships` WHERE `categoryID` = (
			SELECT `categoryID` FROM `blogcetegory` WHERE `categorySlug` = \'' . $categorySlug . '\' LIMIT 0 , 1)';
	$db = mysqlDB::con();
	$BIDarr = $db->getOneArr($sql);
	foreach ($BIDarr as $blog)
	{
		echo $blog . '<br>';
	}
}

function readBid($bid)
{
}

function info($categoryID)
{
	$sql = 'SELECT * FROM `blogcetegory` WHERE `categoryID` =' . $categoryID;
	$db = mysqlDB::con();
}

/**
 * 查看所以分类
 */
function all()
{
	$sql = 'SELECT * FROM `blogcetegory`';
	$db = mysqlDB::con();
	$allType = $db->fetch($sql);
	$view = new smasrty();
	$view->assign('allType', $allType);
	$view->display('categoryAll.html');
}